package ghostcat.parse.graphics
{
    import flash.display.*;
    import flash.geom.*;
    
    import ghostcat.parse.*;

    public class GraphicsBitmapFill extends DisplayParse implements ghostcat.parse.graphics.IGraphicsFill
    {
        public var matrix:Matrix;
        public var smooth:Boolean;
        public var repeat:Boolean;
        public var bitmap:BitmapData;

        public function GraphicsBitmapFill(param1:BitmapData, param2:Matrix = null, param3:Boolean = true, param4:Boolean = false)
        {
            this.bitmap = param1;
            this.matrix = param2;
            this.repeat = param3;
            this.smooth = param4;
            return;
        }// end function

        override public function parseGraphics(param1:Graphics) : void
        {
            super.parseGraphics(param1);
            param1.beginBitmapFill(bitmap, matrix, repeat, smooth);
            return;
        }// end function

        public static function drawBitmpData(param1:Graphics, param2:BitmapData, param3:Number, param4:Number, param5:Number = NaN, param6:Number = NaN) : void
        {
            var _loc_7:Matrix = null;
            var _loc_8:Number = NaN;
            var _loc_9:Number = NaN;
            if (param2)
            {
                _loc_7 = new Matrix();
                _loc_7.translate(param3, param4);
                if (isNaN(param5))
                {
                    param5 = param2.width;
                }
                if (isNaN(param6))
                {
                    param6 = param2.height;
                }
                _loc_8 = param5 / param2.width;
                _loc_9 = param6 / param2.height;
                _loc_7.scale(_loc_8, _loc_9);
                param1.beginBitmapFill(param2, _loc_7, false, false);
                param1.drawRect(param3, param4, param5, param6);
                param1.endFill();
            }
            return;
        }// end function

    }
}
